<?php

namespace addons\prl\controller;
use addons\prl\model\Channels as ChannelsModel;
use addons\prl\model\Views as ViewsModel;
class Channel extends Base
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function _initialize()
    {
        $id = $this->request->param('id');

        $this->current_channel = (new ChannelsModel)->channel($id)->channelorder()->nomal()->find();

        if(empty($this->current_channel))
            return $this->error('栏目未找到！');
        $this->view_type = 1;
        parent::_initialize();
    }

    //栏目页
    public function index()
    {
        $viewName = ViewsModel::where('id', $this->current_channel->channel_view_id)->value('tpl');
        return $this->show($viewName);
    }

    
}
